import cPickle
import pylab
import gzip

f = gzip.open('data/mnist.pkl.gz', 'rb')
training_data, validation_data, test_data = cPickle.load(f)
f.close()
pictures = training_data[0]

for index, pic in enumerate(pictures):    
    pylab.imshow(pic.reshape(28, 28))
    pylab.savefig('./images/' + str(index) + '.png')
